#ifndef __APP_BUFFER_H
#define __APP_BUFFER_H

#include "/home/yaojiayu/Code/Projects/P01_GateWay/common/log/log.h"
#include <pthread.h>
#include <stdlib.h>
#include <string.h>


typedef struct BufferStruct
{
    void *ptr;           //缓存区指针
    int size;            //缓存区总长度
    int len;             //缓存区n内数据的长度
    int start;           //数据起始offset
    pthread_mutex_t lock;//buffer互斥锁
}Buffer;

int app_buffer_init(Buffer *buffer,int size);

int app_buffer_read(Buffer *buffer,void *buf,int len);

int app_buffer_write(Buffer *buffer,void *buf,int len);

void app_buffer_close(Buffer *buffer);


#endif